import java.util.Scanner;
//统计l到r之间数中含有2的个数
public class code1 {
    static int ret ;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt();
        int r = sc.nextInt();;
        for (int i = l; i <=r ; i++) {
            js(i);
        }
        System.out.println(ret);
    }
    //计算count数字2出现的次数
    public static void js(int count) {
        while(count!=0) {
            if(count%10==2) {
                ret++;
            }
            count = count/10;
        }
    }
}
